package com.tq68.weixin.intercept;

import com.jfinal.aop.Interceptor;
import com.jfinal.aop.Invocation;
import com.tq68.weixin.common.AppConstantEnum;
import com.tq68.weixin.common.WeixinConfig;

public class PathIntercept implements Interceptor {

	public void intercept(Invocation inv) {
		String path = inv.getController().getRequest().getContextPath();
		String imgPath = path+"/"+WeixinConfig.uploadpath;
		if(WeixinConfig.uploadpath.startsWith("/")){
			imgPath = path+"/"+AppConstantEnum.IMG_PATH;
		}
		inv.getController().setAttr("imgPath", imgPath);
		inv.invoke();
//		System.out.println("path="+path);
		inv.getController().setAttr("path",path);
	}
}
